<template>
    <!--账号登录注册模板页-->
    <!--导航栏-->
    <div class="account-box">
        <main-guide-bar  class="guide-bar" :list="guides" :search-visible="false"/>

        <div class="body-box">
            <!--表单栏-->
            <div class="form-box">
                <img class="library-sign" src="@/assets/login/logo.png" alt="''">
                <!--登录、注册表单视口-->
                <div class="info-item">
                    <router-view></router-view>
                </div>
            </div>
            <!--尾部栏-->
            <div class="remarks-box">
                <div class="pc-remarks">
                    <div class="remarks-item">常德市图书馆版权所有</div>
                    <div class="remarks-item">技术支持：湖南坤灵信息技术有限公司</div>
                </div>
                <div class="phone-remarks">
                    版权所有©常德市图书馆
                </div>
            </div>
        </div>

    </div>
</template>

<script>
import MainGuideBar from "../../components/MainGuideBar";
import {getTopicChild} from "../../api/CommonApi";

const INDEX_ITEM = {
    title:'首页',
    path:'/index',
    code:'home',
}


export default{
    name:"Index",
    data(){
        return{
            // 导航栏列表
            guides:[INDEX_ITEM],
        }
    },
    components:{
        MainGuideBar
    },

    created(){
        this.loadMainGuiderData("cd")
    },
    methods:{
        // 加载导航栏数据
        loadMainGuiderData(topicCode){
            console.log('loadMainGuiderData')
            getTopicChild(topicCode).then(res => {
                console.log(res)
                const result = res.result || []
                // 填充首页
                result.unshift(INDEX_ITEM)
                this.guides = result
            }).catch(err => {
                console.log(err)
            })
        }
    }

}


</script>


<style lang="less" scoped>
//phone
@media only screen and (max-width: 576px) {
    @width:100vw;
    @min-height:180vw;
    .account-box {
        width:@width;
        min-height:@min-height;
        background-image:url("../../assets/Phone-BackgroundImage/Home.png");
        background-repeat: no-repeat;
        background-position-x: center;
        background-size:100% 100%;
        display:grid;
        grid-template-rows: 20vw auto; //3 : 23
        justify-content: center;
        //导航栏
        .guide-bar{
            width:@width;
            height:20vw;
            grid-row: 1 / span 1;
            grid-column: 1 / span 1;
            .guide-item{
                width:@width;
                height:11vw;
                background-color:#66697A;
            }
        }

        .body-box{
            grid-row: 2 / span 1;
            grid-column: 1 / span 1;
            width:@width;
            min-height:calc(@min-height - 20vw);
            display:flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: center;
            justify-self:center;
            //表单栏
            .form-box{
                width:calc(@width - 6vw); //100vw - 6vw
                min-height:90vw;
                justify-self: center;
                align-self: center;
                padding:5vw 0;
                display:flex;
                flex-direction: column;
                align-items: center;
                background-color:white;
                box-shadow: 1px 3px 15px 3px rgba(16, 77, 126, 0.2);
                border-radius:5px;
                .library-sign{
                    width:45vw;
                    height:7vw;
                    display:block;
                }
                //表单视口
                .info-item{
                    width:calc(@width - 6vw);      //94vw
                    min-height:calc(90vw - 10vw - 7vw);  //73vw
                    max-height:120vw;
                }
            }
            //尾部栏
            .remarks-box{
                width:@width;
                height:25vw;
                display:flex;
                .pc-remarks{
                    display:none;
                }
                .phone-remarks{
                    font-size: 0.7em;
                    font-weight: 400;
                    color: #6C6C6C;
                    line-height: 3em;
                    text-align: center;
                    margin:auto;
                }
            }

        }

    }
}

//pc
@media only screen and (min-width: 576px){
    .account-box{
        @max-width:1200px;
        @min-height:600px;
        min-height: @min-height;
        background-image: url("../../assets/PC-BackgroundImage/SearchBackground.png");
        background-position-x: center;
        background-repeat: no-repeat;
        background-size: cover;
        display:grid;
        grid-template-rows: 120px auto;
        //导航栏
        .guide-bar{
            grid-row: 1 / span 1;
            grid-column: 1 / span 1;

        }
        .body-box{
            grid-row: 2 / span 1;
            grid-column: 1 / span 1;
            max-width:@max-width;
            display:flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            justify-self: center;

            //表单栏
            .form-box{
                width:600px;
                height:400px;
                box-sizing:border-box;
                padding: 20px 0;
                background-color:white;
                border: 1px solid #BFBFBF;
                border-radius: 5px;
                box-shadow: 1px 3px 15px 3px rgba(16, 77, 126, 0.2);
                display:flex;
                flex-direction: column;
                align-items: center;
                //图书馆匾牌图片
                .library-sign{
                    width:180px;
                    height:28px;
                    display:block;
                }
                //表单视口
                .info-item{
                    width:600px;
                    height:calc(400px - 40px - 28px); //332px
                }

            }
            //尾部栏
            .remarks-box{
                max-width:@max-width;
                height:80px;
                display: flex;
                .pc-remarks{
                    margin:auto;
                    .remarks-item{
                        line-height:20px;
                        text-align: center;
                        font-size:12px;
                        font-weight: 400;
                        color: #6C6C6C;
                    }
                }
                .phone-remarks{
                    display:none;
                }
            }

        }

    }
}



</style>
